(function () {
    'use strict';

    angular.module('logcenterApp')
        .config(stateConfig);
    stateConfig.$inject = ['$stateProvider'];
    function stateConfig($stateProvider) {
        $stateProvider.state('alertsub',{
            parent: 'app',
            url: '/logalert/alertsub',
            data: {
                authorities: ['ROLE_ADMIN']
            },
            views: {
                'content@': {
                    templateUrl: 'app/logalert/alertSub/alertSub.html',
                    controller: 'alertSubController',
                    controllerAs: 'vm'
                }
            },
            resolve: {
                logAlertMsgEnabled:getLogAlertMsgEnabled
            }
        })
            .state('alertuser',{
                parent: 'app',
                url: '/logalert/alertuser',
                data: {
                    authorities: ['ROLE_ADMIN']
                },
                views: {
                    'content@': {
                        templateUrl: 'app/logalert/alertUser/alertUser.html',
                        controller: 'alertUserController',
                        controllerAs: 'vm'
                    }
                }
            })
            .state('alertmemo',{
                parent: 'app',
                url: '/logalert/alertmemo',
                data: {
                    authorities: ['ROLE_ADMIN']
                },
                views: {
                    'content@': {
                        templateUrl: 'app/logalert/alertMemo/alertMemo.html',
                        controller: 'alertMemoController',
                        controllerAs: 'vm'
                    }
                }
            })

    }

    getLogAlertMsgEnabled.$inject=['PropertiesService'];
    function getLogAlertMsgEnabled(PropertiesService) {
        return PropertiesService.getProperties().then(function (promiseValue) {
            return promiseValue.logAlertMsgEnabled;
        });
    }
})();
